import axios from 'axios';
import { loginreq, req } from './axiosfun';

// 登录接口 
// export const login = (params) => { return loginreq("post", "/api/AuthorityManagement", params) };
export const login = (params) => { return loginreq("post", "/api/WeatherForecast/Login", params) };
// 获取用户菜单
export const menu = (params) => { return axios.get("/api/menu?&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
// 退出接口
export const loginout = () => { return axios.delete("/api/login?&token=" + localStorage.getItem('logintoken')).then(res => res.data) };

export const getUserTreeMenu=(params)=>{
    return req("get","/api/User/GetUserTreeMenu?userCode="+params)
    }
/**
 * 用户管理 
 **/
// 用户管理-获取用户列表
//export const userList = (params) => { return req("post", "/api/UserInfo", params) };
export const userList = (params) => { return req("post", "/api/User/GetUserList", params) };
// 用户管理-保存（添加编辑）
// export const userSave = (params) => { return req("post", "/api/UserInfo/AddUserInfo", params) };
export const adduser = (params) => { return req("post", "/api/User/Create", params) };
//修改
// export const useredit = (params) => { return req("post", "/api/UserInfo/EditUserInfo", params) };
export const updateuser = (params) => { return req("post", "/api/User/UpdateUser", params) };
//根据id查询
// export const usereditid = (params) => { return req("post", "/api/UserInfo/EditUserInfoid", params) };
export const usereditid = (params) => { return req("post", "/api/User/GetUserId?id="+params, params) };
// 用户管理-删除用户
// export const userDelete = (params) => { return axios.delete("/api/User/delete?ids=" + params + "&token=" + localStorage.getItem('logintoken')).then(res => res.data) };
// export const userDelete = (params) => { return req("delete","/api/UserInfo/DelUserInfo?id=" + params,params )};
export const userDelete = (params) => { return req("delete","/api/User/Delete?id=" + params,params )};
// 用户管理-重置密码
export const userPwd = (params) => { return req("post", "/api/User/ResetPassWord?id="+params, params) };
// export const userPwd = (params) => { return req("post", "/api/UserInfo/UpdatePwd?id="+params, params) };
// 用户管理-修改状态
//export const userLock = (params) => { return axios.get("/api/User/lock?userId=" + params.userId + "&lock=" + params.lock + "&token=" + localStorage.getItem('logintoken')) };
export const userLock = (params,status) => { return req ("post","/api/User/StatusUpdate?id=" + params+"&status="+status,params)};
// 用户管理-数据权限
// export const UserDeptTree = (params) => { return axios.get("/api/UserDept/tree/" + params + "?token=" + localStorage.getItem('logintoken')) };
export const UserDeptTree = (params) => {return req ("post","/api/UserInfo/UserTree?id=" + params,params) };
//GetUserTree
// 用户管理-数据权限保存
export const UserDeptSave = (params) => { return req("post", "/api/UserDept/save", params) };
// 用户管理-获取部门设置
export const UserDeptdeptTree = (params) => { return axios.get("/api/UserDept/deptTree/" + params + "?token=" + localStorage.getItem('logintoken')) };
// 用户管理-保存部门设置
export const UserChangeDept = (params) => { return req("post", "/api/User/change/dept", params) };
// 用户管理-用户下线
export const userExpireToken = (params) => { return req("get", "/api/User/expireToken/" + params, {}) };
// 用户管理-刷新缓存
export const userFlashCache = (params) => { return req("get", "/api/User/flashCache/" + params, {}) };